function [ei,L,R] = Eigen(U,Ori)
% EIGEN - 计算特征值和左右特征矩阵

    [rho,u,v,p]=U2Variables(U);
    gamma = 1.4;
    e = U(4);
    a = sqrt(gamma*p/rho);
    
    if Ori == 1|| Ori == 2              % x方向
        
        s0=(u^2+v^2)/2;s1=-1/(2*a);s2=1/(5*a^2);
        s3=-u/(2*a);s4=(u^2+v^2)/(10*a^2);s5=u/(5*a^2);
        s6=v/(5*a^2);s7=a*u;s8=2.5*a^2;
        
        ei =[u-a;u;u;u+a];
        R = [1,1,0,1;
            u-a,u,0,u+a;
            v,v,rho,v;
            s0-s7+s8,s0,rho*v,s0+s7+s8];
        L = [-s3+s4,s1-s5,-s6,s2;
            1-2*s4,2*s5,2*s6,-2*s2;
            -v/rho,0,1/rho,0;
            s3+s4,-s1-s5,-s6,s2];
    else
       s0=(u^2+v^2)/2;s1=-1/(2*a);s2=1/(5*a^2);
       s3=v/(2*a);s4=(u^2+v^2)/(10*a^2);
       s5=v/(5*a^2);s6=u/(5*a^2);s7=a*v;s8=2.5*a^2;
        ei =[v-a;v;v;v+a];
        R = [1,1,0,1;
             u,u,-rho,u;
             v-a,v,0,v+a;
             s0-s7+s8,s0,-rho*v,s0+s7+s8];
        L = [-s3+s4,-s6,s1-s5,s2;
            1-2*s4,2*s6,2*s5,-2*s2;
            u/rho,-1/rho,0,0;
            s3+s4,-s6,-s1-s5,s2];
    end
    
end